package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONArray;

import com.zr.gdms.model.Student;

import com.zr.gdms.service.StudentServiceSCM;

import com.zr.gdms.serviceimpl.StudentServiceImplSCM;


/**
 * @author  shichongming
 * @E-mail: 
 * @date 创建时间：2017年6月1日 上午10:12:53 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return  
 */

public class SearchScoreStudentMyselfControllerSCM extends HttpServlet{

	StudentServiceSCM stu=new StudentServiceImplSCM();

	
	//查询学生自己的成绩
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	// TODO Auto-generated method stub
	doPost(req, resp);
}
@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {		
	req.setCharacterEncoding("UTF-8");
	resp.setCharacterEncoding("UTF-8");
	HttpSession session = req.getSession();		
	Student st=(Student)session.getAttribute("student");
	
	int sid=st.getSid();
	
	JSONArray js=stu.ssearchStudentMyselfScore(sid);

	PrintWriter pw=resp.getWriter();
	pw.write(js.toString());
	}
}
